package ar.edu.utn.frsf.cidisi.ginet.generation.pnml2wscdl.elementstemplate;

import org.eclipse.emf.common.util.EList;
import org.pnml.tools.epnk.pnmlcoremodel.Page;
import org.w3._2005._10.cdl.CdlFactory;
import org.w3._2005._10.cdl.TChoreography;
import org.w3._2005._10.cdl.TExtensibleElements;
import org.w3._2005._10.cdl.TWorkunit;

public class LoopUntilWSCDL extends WSCDLStructure{
	
	public LoopUntilWSCDL(Page page, TChoreography choreography){
		this.page = page;
		this.choreography = choreography;
	}
	
	public TWorkunit createWSCDLElement(){
		TWorkunit tWorkunit = CdlFactory.eINSTANCE.createTWorkunit();
		
		tWorkunit.setGuard("true");
		tWorkunit.setName("loopUntil");
		
		EList<Page> pages1 = this.getPages(page);
	
		if(pages1.size() >0){
			tWorkunit.setName("loopUntil1");
			TExtensibleElements ele = this.createPackageWscdl(pages1.get(0), this.choreography);
			this.addTo(tWorkunit, ele);
		}
		return tWorkunit;		
	}

}
